package com.atguigu.filter;

import javax.servlet.*;
import java.io.IOException;

public class LifeFilter implements Filter {

    public LifeFilter(){
        System.out.println("构造");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("初始化");
        System.out.println(filterConfig.getInitParameter("dateTimePattern"));
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        /*
        * 生命周期：构造  初始化 过滤  销毁
        *          构造器  init filter destroy
        *
        * */
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        System.out.println("销毁方法");
    }
}
